package siwi.map.android;

import com.wmw.Utility.Common;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;

public class OrderFormReceiver extends Service {
	private static final int _ReceiveIntervalTime = 50000;
	private Handler objHandler = new Handler();

	private int intCounter = 0;

	private Runnable mTasks = new Runnable() {

		public void run() {
			intCounter++;
			Log.i(Common.GetLineInfo(),
					"Counter:" + Integer.toString(intCounter));
			// 添加具体需要做的事情：

			objHandler.postDelayed(mTasks, _ReceiveIntervalTime);
		}
	};
	
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
	    // We want this service to continue running until it is explicitly
	    // stopped, so return sticky.
	    return super.onStartCommand(intent, flags, startId);
	}

	@Override
	public void onCreate() {
		// TODO Auto-generated method stub

		objHandler.postDelayed(mTasks, 1000);
		super.onCreate();
	}

	@Override
	public IBinder onBind(Intent intent) {

		return null;
	}

	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub

		objHandler.removeCallbacks(mTasks);
		super.onDestroy();
	}
}